package com.ruoyi.datastatistics.service.impl;

import java.util.Arrays;
import java.util.Collections;
import java.util.List;
import java.util.Objects;

import com.baomidou.dynamic.datasource.annotation.DS;
import com.ruoyi.common.constant.Constants;
import com.ruoyi.common.core.domain.entity.SysUser;
import com.ruoyi.common.utils.SecurityUtils;
import com.ruoyi.datastatistics.domain.ElectricityRealtimegatherdataXb;
import com.ruoyi.datastatistics.mapper.RealtimegatherdataXbMapper;
import com.ruoyi.datastatistics.vo.XbDatabase;
import com.ruoyi.datastatistics.vo.XbDatabaseVO;
import com.ruoyi.datastatistics.wxentity.WXRealtimegatherdataXb;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import com.ruoyi.datastatistics.mapper.ElectricityRealtimegatherdataXbMapper;
import com.ruoyi.datastatistics.domain.ElectricityRealtimegatherdataXb;
import com.ruoyi.datastatistics.service.IElectricityRealtimegatherdataXbService;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
import org.springframework.transaction.annotation.Transactional;
import com.baomidou.mybatisplus.core.toolkit.StringUtils;
/**
 * 电-历史数据Service业务层处理
 *
 * @author gdqt
 * @date 2025-03-10
 */
@Service
public class ElectricityRealtimegatherdataXbServiceImpl extends ServiceImpl<ElectricityRealtimegatherdataXbMapper,
        ElectricityRealtimegatherdataXb> implements IElectricityRealtimegatherdataXbService
{
    @Autowired
    private ElectricityRealtimegatherdataXbMapper electricityRealtimegatherdataXbMapper;


    /**
     * 查询实时数据采集（小）
     *
     * @param TerminalID 实时数据采集（小）主键
     * @return 实时数据采集（小）
     */
    @Override
    public ElectricityRealtimegatherdataXb selectRealtimegatherdataXbByTerminalID(String TerminalID)
    {
        return electricityRealtimegatherdataXbMapper.selectRealtimegatherdataXbByTerminalID(TerminalID);
    }

    /**
     * 查询实时数据采集（小）列表
     *
     * @param realtimegatherdataXb 实时数据采集（小）
     * @return 实时数据采集（小）
     */
    @Override
    public List<ElectricityRealtimegatherdataXb> selectRealtimegatherdataXbList(ElectricityRealtimegatherdataXb realtimegatherdataXb)
    {
        return electricityRealtimegatherdataXbMapper.selectRealtimegatherdataXbList(realtimegatherdataXb);
    }

    /**
     * 新增实时数据采集（小）
     *
     * @param realtimegatherdataXb 实时数据采集（小）
     * @return 结果
     */
    @Override
    public int insertRealtimegatherdataXb(ElectricityRealtimegatherdataXb realtimegatherdataXb)
    {
        return electricityRealtimegatherdataXbMapper.insert(realtimegatherdataXb);
    }

    @Override
    public Long selectListCountByParams(ElectricityRealtimegatherdataXb meterHistoryData) {
        return electricityRealtimegatherdataXbMapper.selectListCountByParams(meterHistoryData);
    }

    /**
     * 批量新增
     * @param list
     */
    @Transactional
    @Override
    public void batchinsertRealtimegatherdataXb(List<ElectricityRealtimegatherdataXb> list)
    {
        this.saveBatch(list);
    }
    /**
     * 修改实时数据采集（小）
     *
     * @param realtimegatherdataXb 实时数据采集（小）
     * @return 结果
     */
    @Override
    public int updateRealtimegatherdataXb(ElectricityRealtimegatherdataXb realtimegatherdataXb)
    {
        return electricityRealtimegatherdataXbMapper.updateById(realtimegatherdataXb);
    }

    @Override
    public int updateRealtimegatherdataXbByNb(ElectricityRealtimegatherdataXb realtimegatherdataXb) {
        return electricityRealtimegatherdataXbMapper.updateById(realtimegatherdataXb);
    }

    /**
     * 批量删除实时数据采集（小）
     *
     * @param TerminalIDs 需要删除的实时数据采集（小）主键
     * @return 结果
     */
    @Override
    public int deleteRealtimegatherdataXbByTerminalIDs(String[] TerminalIDs)
    {
        return electricityRealtimegatherdataXbMapper.deleteRealtimegatherdataXbByTerminalIDs(TerminalIDs);
    }

    /**
     * 删除实时数据采集（小）信息
     *
     * @param TerminalID 实时数据采集（小）主键
     * @return 结果
     */
    @Override
    public int deleteRealtimegatherdataXbByTerminalID(String TerminalID)
    {
        return electricityRealtimegatherdataXbMapper.deleteRealtimegatherdataXbByTerminalID(TerminalID);
    }

    @Override
    public List<ElectricityRealtimegatherdataXb> selectRealtimegatherdataXbList2(ElectricityRealtimegatherdataXb realtimegatherdataXb) {
        return electricityRealtimegatherdataXbMapper.selectRealtimegatherdataXbList2(realtimegatherdataXb);
    }

    @Override
    public List<ElectricityRealtimegatherdataXb> selectList(ElectricityRealtimegatherdataXb realtimegatherdataXb) {
        return electricityRealtimegatherdataXbMapper.selectList(realtimegatherdataXb);
    }

    @Override
    public List<ElectricityRealtimegatherdataXb> selectRealtimegatherdataXbListForJob(ElectricityRealtimegatherdataXb realtimegatherdataXb) {
        return electricityRealtimegatherdataXbMapper.selectRealtimegatherdataXbListForJob(realtimegatherdataXb);
    }

    @Override
    @Transactional
    public int batchinsertElectricityRealtimegatherdataXb(List<ElectricityRealtimegatherdataXb> list) {
        return baseMapper.insertAllBatch(list);
        // return 1;
    }
}
